/**
 * fulihui.com Inc.
 * Copyright (c) 2015-2016 All Rights Reserved.
 */
package com.fulihui.integral.core.biz.conv;

import com.fulihui.integral.core.dal.dataobj.ISAccountDetail;
import com.fulihui.integral.core.dto.ISAccountDetailDTO;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.stream.Collectors;

public class ISAccountDetailConvert {
    /**
     * 不copy的属性数组
     */
    private static final String[] ignoreProperties = {};

    /**
     * DTO转换成DO
     *
     * @param source
     * @return
     */
    public static ISAccountDetail convertDTO2DO(ISAccountDetailDTO source) {
        if (source == null) {
            return null;
        }
        ISAccountDetail target = new ISAccountDetail();
        BeanUtils.copyProperties(source, target);
        return target;
    }

    /**
     * DO转换成DTO
     *
     * @param source
     * @return
     */
    public static ISAccountDetailDTO convertDO2DTO(ISAccountDetail source) {
        if (source == null) {
            return null;
        }
        ISAccountDetailDTO target = new ISAccountDetailDTO();
        BeanUtils.copyProperties(source, target);
        return target;
    }

    /**
     * doList转换为dtoList
     *
     * @param list
     * @return
     */
    public static List<ISAccountDetailDTO> convert2List(List<ISAccountDetail> list) {
        return list.stream().map(ISAccountDetailConvert::convertDO2DTO)
                .collect(Collectors.toList());

    }
}
